package com.stress.testing.common.conf;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.Properties;

public class DefaultAgentConfigLoader implements AgentConfigLoader {
    @Override
    public AgentConfig load(String agentConfigFullName) {
        Properties pros = null;
        File file = new File(agentConfigFullName);
        FileInputStream inputStream = null;
        if (file.exists() && file.isFile()) {
            try {
                inputStream = new FileInputStream(file);
                pros = new Properties();
                pros.load(inputStream);
            } catch (Exception e) {
            } finally {
                try {
                    inputStream.close();
                } catch (IOException e) {
                }
            }
        }

        return new DefaultAgentConfig(pros);
    }
}
